package Basic.day05;

import java.util.Arrays;

public class MinOfArrayUtil {

    public int getIndex(int[] arr) {
        //查找数组中的最小值
        int max = arr[0];
        int index = 0;
//        int[] maxArray = new int[arr.length];
        //arr去重
        int[] newArray = Arrays.stream(arr).distinct().toArray();
        //找出最小值所在的索引
        for (int i = 0; i < newArray.length; i++){
            if (newArray[i] < max){
                max = newArray[i];
                index = i;
            }
        }
        return index;
    }
}
